<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<head>
	<meta charset="utf-8">
	<title></title>
	<link rel="stylesheet" href="/static/component/pear/css/pear.css" />
	<link rel="stylesheet" href="/static/admin/css/other/person.css" />
</head>
<body class="pear-container">
	<div class="layui-row layui-col-space10">
		<div class="layui-col-md3">
			<div class="layui-card">
				<div class="layui-card-body" style="padding: 25px;">
					<div class="text-center layui-text">
						<div class="user-info-head" id="userInfoHead">
							<img src="" id="userAvatar" width="115px" height="115px" alt="">
						</div>
						<h2 style="padding-top: 20px;font-size: 20px;" th:text="${session.loginUser.userName}"></h2>
						<p style="padding-top: 8px;margin-top: 10px;font-size: 13.5px;">China,中国</p>
					</div>
				</div>
				<div style="height: 45px;border-top: 1px whitesmoke solid;text-align: center;line-height: 45px;font-size: 13.5px;">
					<span>“万事都作糊涂观,无所谓失,无所谓得”</span>
				</div>
			</div>

			<div class="layui-card">
				<div class="layui-card-header">
					归档
				</div>
				<div class="layui-card-body">
					<ul class="list">
						<li class="list-item"><span class="title">优化代码格式</span><span class="footer">2020-06-04 11:28</span></li>
						<li class="list-item"><span class="title">新增消息组件</span><span class="footer">2020-06-01 04:23</span></li>
						<li class="list-item"><span class="title">移动端兼容</span><span class="footer">2020-05-22 21:38</span></li>
						<li class="list-item"><span class="title">系统布局优化</span><span class="footer">2020-05-15 14:26</span></li>
						<li class="list-item"><span class="title">兼容多系统菜单模式</span><span class="footer">2020-05-13 16:32</span></li>
						<li class="list-item"><span class="title">兼容多标签页切换</span><span class="footer">2019-12-9 14:58</span></li>
						<li class="list-item"><span class="title">扩展下拉组件</span><span class="footer">2019-12-7 9:06</span></li>
						<li class="list-item"><span class="title">扩展卡片样式</span><span class="footer">2019-12-1 10:26</span></li>
					</ul>
				</div>
			</div>
		</div>
		<div class="layui-col-md9">
			<div class="layui-card">
				<div class="layui-card-header">
					我的信息
				</div>
				<div class="layui-card-body">
					<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
						<div class="layui-tab-content">
							<form class="layui-form" action="" onsubmit="return false" lay-filter="addform">
								<input type="text" name="id"  placeholder="id" style="display: none" autocomplete="off" class="layui-input"  th:value="${session.loginUser.id}" >
								<div class="layui-form-item">
									<label class="layui-form-label">用户名:</label>
									<div class="layui-input-block">
										<input type="text" name="userCode"  placeholder="请输入输入框内容" autocomplete="off" class="layui-input"  th:value="${session.loginUser.userCode}" >
									</div>
								</div>
								<div class="layui-form-item">
										<label class="layui-form-label">用户名称:</label>
										<div class="layui-input-block">
											<input type="text" name="userName" placeholder="请输入输入框内容" autocomplete="off" class="layui-input"  th:value="${session.loginUser.userName}">
										</div>
									</div>
								<div class="layui-form-item">
									<label class="layui-form-label">旧密码:</label>
									<div class="layui-input-block">
										<input type="password" name="userPassword"  placeholder="请输入输入框内容" autocomplete="off" class="layui-input">
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label">输入新密码:</label>
									<div class="layui-input-block">
										<input type="text"   id="XinMima"  class="XinMima layui-input"  placeholder="请输入输入框内容" autocomplete="off">
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label">确认新密码:</label>
									<div class="layui-input-block">
										<input type="text"     placeholder="请输入输入框内容" autocomplete="off" class="layui-input">
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label">性别:</label>
									<div class="layui-input-block">
										<input type="radio" name="sex"  title="男" th:checked="${session.loginUser.sex=='男'} ? true : false" >
										<input type="radio" name="sex"  title="女" th:checked="${session.loginUser.sex=='女'} ? true : false">
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label">年龄：</label>
									<div class="layui-input-inline">
										<input type="text" name="age"   placeholder="请输入输入框内容" autocomplete="off" class="layui-input" th:value="${session.loginUser.age}">
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label">入职时间:</label>
									<div class="layui-input-inline">
										<input type="text" name="entryDate"    placeholder="请输入输入框内容" autocomplete="off" class="layui-input" th:value="${session.loginUser.entryDate}">
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label">离职日期:</label>
									<div class="layui-input-inline">
										<input type="text" name="dimissionDate"    placeholder="请输入输入框内容" autocomplete="off" class="layui-input" th:value="${session.loginUser.dimissionDate}">
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label">联系电话:</label>
									<div class="layui-input-inline">
										<input type="text" name="phoneTel"  placeholder="请输入输入框内容" autocomplete="off" class="layui-input" th:value="${session.loginUser.phoneTel}">
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label">电子邮件:</label>
									<div class="layui-input-inline">
										<input type="text" name="email"  placeholder="请输入输入框内容" autocomplete="off" class="layui-input" th:value="${session.loginUser.email}">
									</div>
								</div>
								<div class="layui-form-item">
									<div class="layui-input-block">
										<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
										<button type="reset" class="layui-btn layui-btn-primary">重置</button>
									</div>
								</div>
								<div style="height: 45px;border-top: 1px whitesmoke solid;text-align: center;line-height: 45px;font-size: 13.5px;">
									<span>数据重启方可生效</span>
								</div>
							</form>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<script src="/static/component/layui/layui.js"></script>
	<script>
		layui.use(['form','layer','jquery'],function(){
			let form = layui.form;
			let  layer=layui.layer;
			let $=layui.jquery;
			form.on('submit(formDemo)',function(data){
				let parms=layui.form.val("addform");  //拿到表单元素
				//修改密码ajax
				console.log(JSON.stringify(parms));
				//新密码
			    let jiuMiMa=$(".XinMima").val();
				//查询旧密码
				$.ajax({
					url:'/GeRenZhoNgXin/GaiMiMa?JiuMiMa='+jiuMiMa,
					dataType:'json',
					data:JSON.stringify(parms),
					type:'post',
					contentType:'application/json;charset=utf-8',
					success:function(data){
						alert(data+"aa")
						if(data.msg=="基本信息和密码修改成功"){
							   layer.msg(data.msg,{icon:6});
								top.location.href="/logout"
						}else{
							layer.msg(data.msg,{icon:6});
						}
					}
				})
				layer.close(layer.index);
			});
		});
	</script>
	<script>
		layui.use(['jquery', 'element', 'layer'], function () {
			var element = layui.element,
				layer = layui.layer,
				$ = layui.jquery;
			let MODULE_PATH = "operate/";
			$("#userAvatar").attr("src", parent.layui.$(".layui-nav-img").attr("src"));

			window.callback = function (data) {
				layer.close(data.index);
                $("#userAvatar").attr("src", data.newAvatar);
                parent.layui.$(".layui-nav-img").attr("src", data.newAvatar);
            }

			$("#userAvatar").click(function () {
				alert("我要改头像了");
				// layer.open({
				// 	type: 2,
				// 	title: '更换图片',
				// 	shade: 0.1,
				// 	area: ["900px", "500px"],
				// 	content: MODULE_PATH + 'uploadProfile.html',
				// 	btn: ['确定', '取消'],
				// 	yes: function (index, layero) {
				// 		window['layui-layer-iframe' + index].submitForm();
				// 	}
				// });
			});
		});
	</script>
</body>
</html>
